<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="layout" :rules="rules" label-width="100px" id="mvcfm">
      <el-button @click="layoutViewSetSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存布局</el-button>
      <el-button @click="popLayoutImUp('')" type='success' size="mini"><i class='fa fa-edit'></i>修改图片</el-button>
      <el-button @click="gotoPage('/psi/supplychainmana/LayoutViewDetTest?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 修改布局 </span>
      </div>
      <div>
      </div>
    </el-form>
    <el-dialog :visible.sync="LayoutImUpVisible" append-to-body>
      <LayoutImUp v-if="LayoutImUpVisible" ref="LayoutImUp" :popparams="popparams"> </LayoutImUp>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import LayoutImUp from "@/views/psi/supplychainmana/LayoutImUp";
  export default {
    name: 'LayoutViewSet',
    components: {
      LayoutImUp,
    },
    props: ['popparams'],
    data() {
      return {
        LayoutImUpVisible: false,
        LayoutImUpValue: null,
        LayoutImUpDesc: null,
        vueparams: this.getVUEParams(""),
        layout: {},
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/supplychainmana/WarehouseAction/layoutViewSet?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      layoutViewSetSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/psi/supplychainmana/WarehouseAction/layoutViewSetSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/psi/supplychainmana/LayoutViewDetTest/layoutViewDetTest?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
      popLayoutImUp(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.LayoutImUpVisible = !this.LayoutImUpVisible;
      },
    },
  }
</script>
